package com.smart.manager.system.entities.body;

import com.smart.common.entities.core.BaseSearch;
import com.smart.manager.system.entities.enums.TaskState;
import com.smart.manager.system.entities.models.SystemScheduleApp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;


/**
 *
 *
 * @author xiaxuqiu
 * @date 2023/03/26
 */
public class RSystemScheduleTask {

    @Data
    @EqualsAndHashCode(callSuper = true)
    @ApiModel("RSystemScheduleTask1")
    public static class SearchBody extends BaseSearch {

        @ApiModelProperty(value = "程序名称")
        private String title;

        @ApiModelProperty(value = "任务有效状态")
        private TaskState state;

        @ApiModelProperty(value = "备注信息")
        private String remark;
    }


    @Data
    @ApiModel("RSystemScheduleTask2")
    public static class EditBody implements Serializable {


        @ApiModelProperty(value = "任务标题")
        @NotBlank(message = "任务标题不能为空")
        @Length(max = 50, message = "任务标题不能超过50个字符")
        private String title;


        @ApiModelProperty(value = "执行程序TOKEN")
        @NotNull(message = "执行程序TOKEN不能为空")
        private SystemScheduleApp app;


        @ApiModelProperty(value = "方法参数")
        private String params;


        @ApiModelProperty(value = "时间表达式")
        @NotBlank(message = "时间表达式不能为空")
        private String cron;


        @ApiModelProperty(value = "任务有效状态")
        @NotNull(message = "时间表达式不能为空")
        private TaskState state;


        @ApiModelProperty(value = "备注信息")
        private String remark;

    }


}
